/**
 * Author(s): xuming.Wong <xuming.Wong@gmail.com>
 * Origin source from MaNGOS(GPL2).
 * Copyright (C) 2005-2010 MaNGOS <http://getmangos.com/>
 */

#ifndef __LOG_H__
#define __LOG_H__

#include "Common.h"

namespace PQCore
{
	enum LogLevel
	{
		LOG_LVL_MINIMAL = 0,                                    // unconditional and errors
		LOG_LVL_BASIC   = 1,
		LOG_LVL_DETAIL  = 2,
		LOG_LVL_DEBUG   = 3
	};

	class Log
	{
	public:
		static Log& getSingleton();
		static void WaitBeforeContinueIfNeed();
		void outError(const char* err, ... );
		void outString(const char * str, ... );
		void outString();

		void debugLog(const char * str, ...);
		void detailLog(const char * str, ...);
		void outDebug( const char * str, ... );
		void outDebugInLine( const char * str, ... );
		bool IsIncludeTime() const { return _includeTime; }
		bool HasLogLevelOrHigher(LogLevel level) const { return _logLevel >= level || (_logFileLevel >= level && logfile); }
	private:
		 FILE* logfile;
		 // log/console control
        LogLevel _logLevel;
        LogLevel _logFileLevel;
		bool _includeTime;

	};

}
#define SLog PQCore::Log::getSingleton()

#endif
